package com.supermap.dataservice.project.service;


import com.alibaba.dubbo.config.annotation.Service;
import com.supermap.dataservice.mysql.config.DynamicDataSourceContextHolder;
import com.supermap.dataservice.project.mapper.ExpertAdvMapper;
import com.supermap.dataservice.util.JSONUtil;
import com.supermap.dubbo.api.product.ExpertAdvService;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author aqua
 * @description
 * @date 2018年11月06 下午 5:21
 * @email 1301584033@qq.com
 */
@Service
public class ExpertAdvServiceImpl  implements ExpertAdvService {
    @Resource
    private ExpertAdvMapper expertAdvMapper;

    @Override
    public JSONUtil getListAdvComment(Integer expertId) {
        DynamicDataSourceContextHolder.setDataSourceKey("ds2");
        List<Map<String,Object>> mapList=expertAdvMapper.getListAdvComment(expertId);
        return mapList.size()>0?new JSONUtil().setData(mapList):new JSONUtil().setCode(100).setIsSuccess(false).setMsg("没有查询到数据");
    }

    @Override
    public JSONUtil getExpert(Integer expertId) {
        DynamicDataSourceContextHolder.setDataSourceKey("ds1");
        List<Map<String,Object>> mapList=expertAdvMapper.getExpert(expertId);
        return mapList.size()>0?new JSONUtil().setData(mapList):new JSONUtil().setCode(100).setIsSuccess(false).setMsg("没有查询到数据");
    }


}
